Skip to content

Conversation

@Henry-Hiles
Copy link

@Henry-Hiles Henry-Hiles commented Nov 11, 2025

Adds some various improvements and customization options

@Henry-Hiles Henry-Hiles changed the title feat: add sendOnEnter to Composer various improvements Nov 15, 2025
final Widget? topWidget;

/// Widget to display as text, overriding message text.
final Widget? customWidget;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this - if you don't want markdown you just don't use this lib - default is SimpleTextMessage that does not use markdown. If you need a 3rd party lib - you should just copy the code and change it, and provide your class to the textMessageBuilder - this is a correct way to fully override.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, I want all the features of the FlyerChatTextMessage, and the nice UI, but I need to be able to render HTML.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, just copy the code and use HTML :) I specifically created the builders pattern to avoid all the "customXXX" stuff that was everywhere in v1 - people would throw all sorts of things in there and then complain the package didn't work. Now, when someone needs something super custom, I prefer to give them full control and responsibility.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but thats a lot of code I need to copy, when I only want to change the display of one widget...
I guess I can just maintain a fork of this for my purposes.

/// If `true`, typing enter will send the message, and typing shift+enter
/// will type enter. If `false`, typing shift+enter will send the message.
/// Defaults to `false`.
final bool sendOnEnter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels incomplete. right now shift+enter will also send a message and enter will make a new line. if you want to send on enter - how user makes a new line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable makes it so that the message sends on enter, and shift+enter only adds a new line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the change to send on enter, but did not see the code for the new line itself - is it automatic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used an XOR operator for it on line 222 of composer.dart, inside your existing logic for this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely works, I'm using it in my app right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants